# coding: utf-8
"""
    All the web applications start here...
"""
import web
from web.contrib.template import render_mako
from models.mysql import load_sqlalchemy
from configs import *
from urls import *

#web.config.debug = False

app = web.application(urls, locals())

session = web.session.Session(app, web.session.DiskStore(session_store_path), initializer = {'user': None, 'others': {}})
def session_hook():
    web.ctx.session = session
    
app.add_processor(load_sqlalchemy)      # load sqlalchemy
app.add_processor(web.loadhook(session_hook))         # load session

if __name__ == '__main__':
    app.run()
